<template>
<div class="leftBody">
  <div class="notice box">
    <div class="titleRow flex flex-between">
      <h1 class="title">最新公告</h1>
      <p class="more">更多</p>
    </div>
    <div class="content">
      <ul>
        <li v-for="(item,index) in notice" :key="'notice'+index">
          <span class="time">{{item.time}}</span> <a class="des" href="#">{{item.title}}</a>
        </li>
      </ul>
    </div>
  </div>
  <div class="news box">
    <div class="titleRow flex flex-between">
      <h1 class="title">新闻资讯</h1>
      <p class="more">{{newsIndex}}/99</p>
    </div>
    <el-carousel height="180px" :autoplay="false"
                 class="swipe" arrow="always" @change="onNewsChange">
      <el-carousel-item v-for="(item,index) in news" :key="'news'+index">
        <div class="swipeItem">
          <div class="news1 flex" v-for="(itemSon,index) in item" :key="'newsSon'+index">
            <img :src="itemSon.img">
            <h1><a href="#">{{itemSon.title}}</a></h1>
          </div>
        </div>
      </el-carousel-item>
    </el-carousel>
  </div>
  <div class="bdrjy box">
    <div class="titleRow flex flex-between">
      <h1 class="title">北大人寄语</h1>
      <p class="more">{{bdrjyIndex}}/{{bdrjyLength}}</p>
    </div>
    <el-carousel height="130px" :autoplay="false" arrow="always"
                 class="swipe" @change="onBdrjyChange">
      <el-carousel-item v-for="(item,index) in bdrjy" :key="'bdrjy'+index">
        <div class="swipeItem flex">
          <img :src="item.img">
          <div>
            <h1>{{item.name}}</h1>
            <h2>{{item.des}}</h2>
          </div>
        </div>
      </el-carousel-item>
    </el-carousel>
  </div>
</div>
</template>

<script>
import Vue from 'vue';
import {Carousel,CarouselItem} from 'element-ui';
Vue.use(Carousel);
Vue.use(CarouselItem);
export default {
name: "leftBody",
  data(){
  return{
    false:false,
    newsIndex:1,
    bdrjyIndex:1,
    bdrjyLength:99
  }
  },
  props:{
    notice:{
      type:Array
    },
    news:{
      type:Array
    },
    bdrjy:{
      type:Array
    },
  },
  methods:{
    onBdrjyChange(index){
      this.bdrjyIndex=index+1
    },
    onNewsChange(index){
      this.newsIndex=index+1;
    }
  }
}
</script>

<style lang="less" scoped>
a:visited{
  color: #000;
}
a:hover{
  color: #000;
}
.leftBody{
  .notice{
    padding: 20px;
    width: 400px;
    .titleRow{
      margin-bottom: 10px;
      .title{
        color: #004E72;
        font-size: 16px;
        font-weight: bold;
      }
      .more{
        font-size: 12px;
      }
    }
    .content{
      line-height: 23px;
      .time{
        font-size: 12px;
      }
      .des{
        font-size: 14px;
      }
    }
  }
  .news {
    padding: 20px;
    width: 400px;
    .titleRow {
      margin-bottom: 10px;
      .title {
        color: #004E72;
        font-size: 16px;
        font-weight: bold;
      }

      .more {
        font-size: 12px;
      }
    }
    .swipe{
      .swipeItem{
        padding: 10px 0;
        .news1,.news2{
          margin-bottom: 10px;
          img{
            width: 78px;
            height: 78px;
            margin-right: 10px;
          }
          h1{
            font-size: 14px;
            font-weight: normal;
            line-height: 25px;
          }
        }

      }
    }
  }
  .bdrjy{
    width: 400px;
    height: 190px;
    padding: 20px;
    background-color: #F7F5EF;
    .titleRow {
      margin-bottom: 10px;
      .title {
        color: #004E72;
        font-size: 16px;
        font-weight: bold;
      }

      .more {
        font-size: 12px;
      }
    }
    .swipe{
      .swipeItem{
        padding: 10px 20px;
        img{
          width: 100px;
          height: 100px;
          margin-right: 10px;
        }
        h1{
          font-size: 18px;
          font-weight: normal;
          line-height: 30px;
        }
        h2{
          font-size: 14px;
          font-weight: normal;
          line-height: 25px;
        }
      }
    }
  }
}
/deep/ .el-carousel__indicator{
  display: none;
}
/deep/ .el-carousel__arrow{
}
</style>